<template>
    <div>
        <div class="conentStype">

            <div>
                <div class="flex">
                    <img class="conentImg" src="../../../../static/engineering5188/company/logop.png" alt="" />
                    <div class="rightdiv">
                        <div class="titletxt">{{ userInfo.company_title }}</div>
                        <div class="titlename" @click="$router.push('/supplierIndex/SupplierCompany')">修改信息></div>
                    </div>
                </div>
                <div class="btnclass"  v-if="userInfo.beFx == 0 || userInfo.beFx == 1" @click="applayData">
                    申请成为分销商
                </div>
                <div v-if="userInfo.beFx == 2" class="yaoqingDiv">
                    <div class="yaoqingDiv-code">邀请码：<span class="code-color">{{ userInfo.invite_code }}</span></div>
                    <div class="yaobtn" @click="newShareOn">我要邀请</div>
                </div>

            </div>

            <div class="right-div">
                <div class="labe-div">
                    <div class="gray">会员年限：</div>
                    <div class="orage">{{ userInfo.level_year ? userInfo.level_year : '0' }}年</div>
                    <div class="vip-div" v-if="userInfo.level_year">
                        <img class="vipclass" src="../../../../static/engineering5188/company/vip@2x.png" alt="" />
                        还有 <span>{{ userInfo.level_time }}</span> 天到期
                    </div>
                    <div class="xufei-div" @click="openChongzhi">立即续费</div>
                </div>
                <div class="labe-div">
                    <span class="gray">会员身份：</span><span class="black">{{ userInfo.ifBuy ? 'VIP供应商' : '供应商' }}</span>
                </div>
                <div class="labe-div">
                    <span class="gray">会员天数：</span><span class="black">{{ userInfo.level_time }}</span>
                </div>
                <div class="labe-div">
                    <span class="gray">绑定手机：</span><span class="black">{{ userInfo.mobile ? '已绑定' : '未绑定' }}</span>
                </div>
                <div class="labe-div">
                    <span class="gray">绑定邮箱：</span><span class="black">{{ userInfo.email }}</span>
                </div>
            </div>

        </div>


        <div v-if="userInfo.beFx == 2">
            <div class="jinQi">

                近期收益
            </div>



            <ul>
                <li :class="indexNum === 1 ? 'liStypeHover' : 'liStype'" @click="OpenTody">今日</li>
                <li :class="indexNum === 2 ? 'liStypeHover' : 'liStype'" @click="OpenYes">昨日</li>
                <li :class="indexNum === 3 ? 'liStypeHover' : 'liStype'" @click="OpenWeek">近7日</li>
                <li :class="indexNum === 4 ? 'liStypeHover' : 'liStype'" @click="OpenMount">近1个月</li>
                <li :class="indexNum === 5 ? 'liStypeHover' : 'liStype'" @click="OpenthirdMount">近3个月</li>
            </ul>


            <div class="shouyiData">
                <div class="dataDiv">
                    <div class="numberData">{{ numObj.num }}</div>
                    <div class="numberText">推荐数量</div>
                </div>
                <div class="dataDivTwo">
                    <div class="numberData">{{ numObj.money }}</div>
                    <div class="numberText">分销金额</div>
                </div>
            </div>
        </div>
        <!-- 申请提现 -->




        <!-- 收款账户 -->

        <!-- 提现记录 -->


        <NewPayment ref="NewPayment"></NewPayment>
        <newShare ref="newShare" :type="1"></newShare>

    </div>
</template>

<script>
import { mapState } from 'vuex';
import NewPayment from '../newSupplier/compayPage/newPayment.vue';
import newShare from "../newShare.vue";

export default {
    name: "SupplierCommission",
    components: {
        NewPayment,
        newShare,
    },
    computed: {
        ...mapState([
            "userInfo",
        ]),
    },
    data() {
        return {
            indexNum: 1,
            pageIndex: 1,
            dataObj: {},
            numObj: {
                num: 0,
                money: 0
            },
            shopInfo: {}
        }
    },
    created() {
        this.getData();
    },
    methods: {
        newShareOn() {
            this.$refs.newShare.isVisible = true;
        },
        openChongzhi() {
            this.$refs.NewPayment.setVisible();
        },
        applayData() {
            this.$httpApi("/api/toBeAgent", {
                token: this.userInfo.token
            }, 'get').then(res => {
                if (res.code == 200) {
                    this.getData();
                    alertSucc('申请成功，请等待审核')
                } else {
                    alertErr(res.msg)
                }

            })
        },
        getShopData() {
            this.$httpApi("/api/userInfo", {
                token: this.userInfo.token
            }, 'get').then(res => {
                console.log(res)
                this.shopInfo = res.data.userInfo;

                // this.form = res.data.userInfo;
            })
        },
        getData() {
            this.$httpApi("/api/userData", {
                token: this.userInfo.token
            }, 'get').then(res => {
                this.dataObj = res.data;
                this.OpenTody();
            })
        },
        OpenTody() {
            this.indexNum = 1;
            this.numObj = this.dataObj.today
        },
        OpenYes() {
            this.indexNum = 2;
            this.numObj = this.dataObj.yestoday
        },
        OpenWeek() {
            this.indexNum = 3;
            this.numObj = this.dataObj.week
        },
        OpenMount() {
            this.indexNum = 4;
            this.numObj = this.dataObj.month
        },
        OpenthirdMount() {
            this.indexNum = 5;
            this.numObj = this.dataObj['3month']
        },
        cancel(num) {
            this.pageIndex = num
        }
    }

}
</script>

<style lang="less" scoped>
.yaoqingDiv {
    display: flex;
    margin-left: 140px;
}

.code-color {
    font-weight: 400;
    font-size: 14px;
    color: #666666;
}

.yaobtn {
    width: 133px;
    height: 36px;
    background: #FF7400;
    border-radius: 30px 30px 30px 30px;
    border: 1px solid #FF7400;
    font-weight: 400;
    font-size: 14px;
    color: #FFFFFF;
    line-height: 36px;
    text-align: center;
    margin-left: 12px;
    cursor: pointer;
}

.yaoqingDiv-code {
    font-weight: 400;
    font-size: 14px;
    color: #333333;
    line-height: 36px;
}

.xufei-div {
    width: 112px;
    height: 36px;
    background: #EFF4FD;
    border: 1px solid #0052D9;
    font-weight: 400;
    font-size: 14px;
    color: #0052D9;
    line-height: 36px;
    text-align: center;
    border-radius: 100px;
    margin-left: 12px;
    cursor: pointer;
}

.right-div {
    margin-right: 150px;
}

.labe-div {
    font-weight: 400;
    font-size: 14px;
    color: #333333;
    line-height: 24px;
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.gray {
    color: #333333;
}

.black {
    color: #000;
}

.orage {
    color: #FF7400;
}

.vipclass {
    width: 15px;
    height: 13px;
    margin-right: 4px;
}

.vip-div {
    display: flex;
    width: 130px;
    height: 24px;
    background: #FF7400;
    border-radius: 100px 100px 100px 100px;
    font-weight: bold;
    font-size: 12px;
    color: #FFFFFF;
    line-height: 24px;
    text-align: center;
    justify-content: center;
    align-items: center;
    margin-left: 12px;
}

.btnclass {
    width: 133px;
    height: 36px;
    background: #FF7400;
    border-radius: 30px 30px 30px 30px;
    border: 1px solid #FF7400;
    font-weight: bold;
    font-size: 14px;
    color: #FFFFFF;
    line-height: 36px;
    text-align: center;
    margin-left: 147px;
    margin-top: 16px;
cursor: pointer;
}

.conentImg {
    width: 100px;
    height: 100px;
}

.rightdiv {
    margin-left: 47px;

    .titletxt {
        font-weight: 500;
        font-size: 20px;
        color: #333333;
    }

    .titlename {
        font-weight: 400;
        font-size: 14px;
        color: #0052D9;
        line-height: 20px;
        text-align: left;
        font-style: normal;
        text-decoration-line: underline;
        cursor: pointer;
        margin-top: 16px;
        cursor: pointer;
    }
}

.flex {
    display: flex;
}

.dataDiv {
    margin-left: 78px;
}

.dataDivTwo {
    margin-left: 169px;
}

.numberText {

    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #606060;

    font-style: normal;
    text-transform: none;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0);
}

.numberData {
    font-family: DIN Alternate, DIN Alternate;
    font-weight: bold;
    font-size: 28px;
    color: #333333;

    font-style: normal;
    text-transform: none;
}

.shouyiData {
    width: 1157px;
    height: 126px;
    background: #F8F9FD;
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #DCDFE9;
    margin: 17px auto;
    display: flex;
    align-items: center;
    text-align: center;
}

ul {
    display: flex;
    margin-left: 30px;
    margin-top: 24px;
}

.liStype {
    padding: 6px 14px;
    background: #EFF4FD;
    border-radius: 20px 20px 20px 20px;
    margin-right: 16px;

    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #5D5D5D;

    font-style: normal;
    text-transform: none;
}


.liStypeHover {
    padding: 6px 14px;
    background: #F8F9FD;
    border-radius: 20px 20px 20px 20px;
    border: 1px solid #0052D9;
    margin-right: 16px;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #0052D9;

    font-style: normal;
    text-transform: none;
}


.jinQi {
    font-family: PingFang SC, PingFang SC;
    font-weight: 500;
    font-size: 16px;
    color: #333333;
    padding: 0 30px;
    font-style: normal;
    text-transform: none;
}

.lookJl {

    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 20px;
    color: #333333;

    font-style: normal;
    text-transform: none;
}

.lookDta {
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: 400;
    font-size: 14px;
    color: #2445CB;
    font-style: normal;
    text-transform: none;
    margin-top: 20px;
}


.numright {
    margin-left: 20px;
    margin-top: 5px;
}

.spanNum {

    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 16px;
    color: #333333;

    font-style: normal;
    text-transform: none;

}

.tixianNum {

    font-family: DIN Alternate, DIN Alternate;
    font-weight: bold;
    font-size: 28px;
    color: #333333;

    font-style: normal;
    text-transform: none;
}

.tixianTextTwo {

    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #606060;
    margin-top: 11px;
    font-style: normal;
    text-transform: none;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0);
}

.tixianText {

    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 14px;
    color: #606060;

    font-style: normal;
    text-transform: none;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0);
}

.imgesStype img {
    width: 60px;
    height: 60px;
}

.buttonClose {
    width: 100px;
    background: #FF7A01;
    border-radius: 4px 4px 4px 4px;
    font-family: PingFang SC, PingFang SC;
    font-weight: 400;
    font-size: 18px;
    color: #FFFFFF;
    font-style: normal;
    text-transform: none;

}

.team {
    width: 246px;
    height: 136px;
    background: #FFF9F6;
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #EFE2DC;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 27px;
}

.collection {
    width: 246px;
    height: 136px;
    background: #EEF7F9;
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #D1E1E5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 27px;
}

.Records {
    width: 246px;
    height: 136px;
    background: #F8F9FD;
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #DCDFE9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 27px;

}

.embody {
    width: 379px;
    height: 136px;
    background: #FEF7EA;
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #EEE0C8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 20px;
}

.conentStype {
    display: flex;
    padding: 36px 28px;
    justify-content: space-between;
}

.title {
    height: 56px;
    background: #FFFFFF;
    line-height: 56px;
    border-radius: 0px 0px 0px 0px;
    font-family: Microsoft YaHei, Microsoft YaHei;
    font-weight: bold;
    font-size: 16px;
    color: #333333;
    font-style: normal;
    text-transform: none;
    border-bottom: 4px solid #F5F5F5;
    padding-left: 32px;
}
</style>